const app = getApp()

// 封装请求方法

export default (url, data, method = 'GET', header = {}) => {
    wx.showLoading({ title: 'Loading...' })
    return new Promise((resolve, reject) => {
        wx.request({
            url: app.config.apiBase + url,
            data,
            header,
            method,
            dataType: 'json',
            success: resolve,
            fail: reject,
            complete: wx.hideLoading
        })
    })
}